MAIN.controller('monitorCtrl', ["$scope", "$rootScope", "tools", function ($scope, $rootScope, tools) {
}]);
// 效果监控-月平均交易额对比
MAIN.directive("salesMonitorChart", ["$rootScope", "tools", function ($rootScope, tools) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attrs) {
            var shopsMonitorChart = echarts.init($(element).find('.chart-box')[0], theme);
            var title = "";
            var xAxis = [];
            var option;
            if (tools.datasource) {
                if (attrs.type == 'town') {
                    tools.get({
                        url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                        data: {
                            uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                            moduleId: 1316110050114,
                            moduleType: 'chart'
                        },
                        succ: function (resp) {
                            if (resp.success) {
                                option = resp.value.option;
                                option.title = {
                                    text: '2016' + tools.town() + '农村电子商务十强镇月平均交易额对比(万元)',
                                    x: 'center'
                                };
                                option.yAxis = [
                                    {
                                        type: 'value',
                                        axisLabel: {
                                            textStyle: {
                                                color: '#fff'
                                            }
                                        }
                                    }
                                ];
                                angular.forEach(option.xAxis[0].data, function (item, index) {
                                    option.xAxis[0].data[index] = {value: item, textStyle: {color: '#fff'}};
                                });
                                option.toolbox.show = false;
                                option.legend.show = false;
                                option.series[0].itemStyle = {};
                                shopsMonitorChart.setOption(option);
                            }
                        }
                    });
                } else if (attrs.type == 'indestry') {
                    tools.get({
                        url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                        data: {
                            uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                            moduleId: 1316110050453,
                            moduleType: 'chart'
                        },
                        succ: function (resp) {
                            if (resp.success) {
                                option = resp.value.option;
                                option.title = {
                                    text: '2016' + tools.town() + '农村电子商务十强行业月平均交易额对比(万元)',
                                    x: 'center'
                                };
                                option.yAxis = [
                                    {
                                        type: 'value',
                                        axisLabel: {
                                            textStyle: {
                                                color: '#fff'
                                            }
                                        }
                                    }
                                ];
                                angular.forEach(option.xAxis[0].data, function (item, index) {
                                    option.xAxis[0].data[index] = {value: item, textStyle: {color: '#fff'}};
                                });
                                option.toolbox.show = false;
                                option.legend.show = false;
                                option.series[0].itemStyle = {};
                                shopsMonitorChart.setOption(option);
                            }
                        }
                    });
                }

            } else {
                var datas = {
                    town: {
                        before: [154212.99, 214353.39, 215030.28, 399673.91, 169074.29, 133800.36, 189886.26, 107578.18, 73115.31, 154743.80],
                        after: [289609.83, 279018.67, 350650.22, 613877.57, 251200.78, 231491.07, 414725.91, 168856.52, 221117.22, 354775.19]
                    },
                    indestry: {
                        before: [33774.11, 122415.41, 110016.66, 89931.98, 78402.16, 47808.82, 38031.43, 16389.73, 6458.89, 3659.61],
                        after: [54877.23, 290784.17, 128784.36, 110345.34, 103619.33, 65549.76, 56419.96, 20189.50, 16754.0, 7728.57]
                    }
                };
                if (attrs.type == 'town') {
                    title = '2016' + tools.town() + '农村电子商务十强镇扶持前与扶持后月平均交易额对比(万元)';
                    var towns = tools.towns().slice(0, 9);
                    angular.forEach(towns, function (val) {
                        xAxis.push({
                            value: val,
                            textStyle: {color: '#fff'}
                        });
                    });
                } else if (attrs.type == 'indestry') {
                    title = '2016' + tools.town() + '农村电子商务十强行业扶持前与扶持后月平均交易额对比(万元)';
                    var industrys = tools.industrys().slice(0, 9);
                    angular.forEach(industrys, function (val) {
                        xAxis.push({
                            value: val,
                            textStyle: {color: '#fff'}
                        });
                    });
                }

                option = {
                    title: {
                        text: title,
                        subtext: '',
                        x: 'center'
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data: []
                    },
                    toolbox: {
                        show: false
                    },
                    xAxis: [
                        {
                            type: 'category',
                            data: xAxis
                        }
                    ],
                    yAxis: [
                        {
                            type: 'value',
                            axisLabel: {
                                textStyle: {
                                    color: '#fff'
                                }
                            }
                        }
                    ],
                    series: [
                        {
                            name: '扶持前',
                            type: 'bar',
                            data: datas[attrs.type].before,
                            markPoint: {
                                data: [
                                    {type: 'max', name: '最大值'},
                                    {type: 'min', name: '最小值'}
                                ]
                            },
                            markLine: {
                                data: [
                                    {type: 'average', name: '平均值'}
                                ]
                            }
                        },
                        {
                            name: '扶持后',
                            type: 'bar',
                            data: datas[attrs.type].after,
                            markPoint: {
                                data: [
                                    {type: 'max', name: '最大值'},
                                    {type: 'min', name: '最小值'}
                                ]
                            },
                            markLine: {
                                data: [
                                    {type: 'average', name: '平均值'}
                                ]
                            }
                        }
                    ]
                };
                shopsMonitorChart.setOption(option);
            }
            ;

            shopsMonitorChart.on(echarts.config.EVENT.CLICK, function (param) {
                option.title.text = '2016' + param.name + '各村电子商务扶持前与扶持后月平均交易额对比(万元)';
                var villages = tools.villages().slice(0, 6);
                xAxis.length = 0;
                angular.forEach(villages, function (val) {
                    xAxis.push({
                        value: val,
                        textStyle: {color: '#fff'}
                    });
                });
                shopsMonitorChart.setOption(option);
            });

            scope.fullscreen = function () {
                $rootScope.$broadcast('fullscreen', option);
            }
        },
        template: '<div class="chart-container w h pr"><div class="chart-box w h"></div><div class = "full-screen right-bottom-pos" ng-click = "fullscreen()"></div></div>'
    }
}]);
// 效果监控-从业人数监控
MAIN.directive("employeesMonitorChart", ["$rootScope", "tools", function ($rootScope, tools) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attrs) {
            var shopsMonitorChart = echarts.init($(element).find('.chart-box')[0], theme);
            var title = "";
            var xAxis = [];
            var option;
            if (attrs.type == 'town') {
                title = '2016' + tools.town() + '农村电子商务十强镇扶持前与扶持后从业人数对比';
                var towns = tools.towns().slice(0, 9);
                angular.forEach(towns, function (val) {
                    xAxis.push({
                        value: val,
                        textStyle: {color: '#fff'}
                    });
                });
            } else if (attrs.type == 'indestry') {
                title = '2016' + tools.town() + '农村电子商务十强行业扶持前与扶持后从业人数对比';
                var industrys = tools.industrys().slice(0, 9);
                angular.forEach(industrys, function (val) {
                    xAxis.push({
                        value: val,
                        textStyle: {color: '#fff'}
                    });
                });
            }
            if (tools.datasource) {
                if (attrs.type == 'town') {
                    tools.get({
                        url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                        data: {
                            uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                            moduleId: 1316110050135,
                            moduleType: 'chart'
                        },
                        succ: function (resp) {
                            if (resp.success) {
                                option = resp.value.option;
                                option.title = {
                                    text: '2016' + tools.town() + '农村电子商务十强镇从业人数对比',
                                    subtext: '',
                                    x: 'center'
                                };
                                option.yAxis = [
                                    {
                                        type: 'value',
                                        axisLabel: {
                                            textStyle: {
                                                color: '#fff'
                                            }
                                        }
                                    }
                                ];
                                angular.forEach(option.xAxis[0].data, function (item, index) {
                                    option.xAxis[0].data[index] = {value: item, textStyle: {color: '#fff'}};
                                });
                                option.toolbox.show = false;
                                option.legend.show = false;
                                option.series[0].itemStyle = {};
                                shopsMonitorChart.setOption(option);
                            }
                        }
                    });
                } else if (attrs.type == 'indestry') {
                    tools.get({
                        url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                        data: {
                            uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                            moduleId: 1316110050557,
                            moduleType: 'chart'
                        },
                        succ: function (resp) {
                            if (resp.success) {
                                option = resp.value.option;
                                option.title = {
                                    text: '2016' + tools.town() + '农村电子商务十强行业从业人数对比',
                                    subtext: '',
                                    x: 'center'
                                };
                                option.yAxis = [
                                    {
                                        type: 'value',
                                        axisLabel: {
                                            textStyle: {
                                                color: '#fff'
                                            }
                                        }
                                    }
                                ];
                                angular.forEach(option.xAxis[0].data, function (item, index) {
                                    option.xAxis[0].data[index] = {value: item, textStyle: {color: '#fff'}};
                                });
                                option.toolbox.show = false;
                                option.legend.show = false;
                                option.series[0].itemStyle = {};
                                shopsMonitorChart.setOption(option);
                            }
                        }
                    });
                }
            } else {
                var datas = {
                    town: {
                        before: [122, 131, 140, 155, 168, 179, 188, 109, 120, 138],
                        after: [140, 169, 190, 221, 250, 288, 301, 333, 379, 423]
                    },
                    indestry: {
                        before: [79, 83, 89, 95, 103, 109, 114, 120, 124, 130],
                        after: [132, 156, 177, 192, 201, 223, 243, 253, 260, 288]
                    }
                };
                option = {
                    title: {
                        text: title,
                        subtext: '',
                        x: 'center'
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data: []
                    },
                    toolbox: {
                        show: false
                    },
                    xAxis: [
                        {
                            type: 'category',
                            data: xAxis
                        }
                    ],
                    yAxis: [
                        {
                            type: 'value',
                            axisLabel: {
                                textStyle: {
                                    color: '#fff'
                                }
                            }
                        }
                    ],
                    series: [
                        {
                            name: '扶持前',
                            type: 'line',
                            data: datas[attrs.type].before,
                            markPoint: {
                                data: [
                                    {type: 'max', name: '最大值'},
                                    {type: 'min', name: '最小值'}
                                ]
                            },
                            markLine: {
                                data: [
                                    {type: 'average', name: '平均值'}
                                ]
                            }
                        },
                        {
                            name: '扶持后',
                            type: 'line',
                            data: datas[attrs.type].after,
                            markPoint: {
                                data: [
                                    {type: 'max', name: '最大值'},
                                    {type: 'min', name: '最小值'}
                                ]
                            },
                            markLine: {
                                data: [
                                    {type: 'average', name: '平均值'}
                                ]
                            }
                        }
                    ]
                };
                shopsMonitorChart.setOption(option);
            }


            shopsMonitorChart.on(echarts.config.EVENT.CLICK, function (param) {
                option.title.text = '2016' + param.name + '各村电子商务扶持前与扶持后从业人数对比';
                var villages = tools.villages().slice(0, 6);
                xAxis.length = 0;
                angular.forEach(villages, function (val) {
                    xAxis.push({
                        value: val,
                        textStyle: {color: '#fff'}
                    });
                });
                shopsMonitorChart.setOption(option);
            });
            scope.fullscreen = function () {
                $rootScope.$broadcast('fullscreen', option);
            }
        },
        template: '<div class="chart-container w h pr"><div class="chart-box w h"></div><div class = "full-screen right-bottom-pos" ng-click = "fullscreen()"></div></div>'
    }
}]);
// 效果监控-店铺数监控
MAIN.directive("shopsMonitorChart", ["$rootScope", "tools", function ($rootScope, tools) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attrs) {
            var shopsMonitorChart = echarts.init($(element).find('.chart-box')[0], theme);
            var title = "";
            var xAxis = [];
            var option;
            if (tools.datasource) {
                if (attrs.type == 'town') {
                    tools.get({
                        url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                        data: {
                            uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                            moduleId: 1316113031543,
                            moduleType: 'chart'
                        },
                        succ: function (resp) {
                            if (resp.success) {
                                option = resp.value.option;
                                option.title = {
                                    text: '2016' + tools.town() + '农村电子商务十强镇店铺数对比',
                                    x: 'center'
                                };
                                option.yAxis = [
                                    {
                                        type: 'value',
                                        axisLabel: {
                                            textStyle: {
                                                color: '#fff'
                                            }
                                        }
                                    }
                                ];
                                angular.forEach(option.xAxis[0].data, function (item, index) {
                                    option.xAxis[0].data[index] = {value: item, textStyle: {color: '#fff'}};
                                });
                                option.toolbox.show = false;
                                option.legend.show = false;
                                shopsMonitorChart.setOption(option);
                            }
                        }
                    });
                } else if (attrs.type == 'indestry') {
                    tools.get({
                        url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                        data: {
                            uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                            moduleId: 1316113031653,
                            moduleType: 'chart'
                        },
                        succ: function (resp) {
                            if (resp.success) {
                                option = resp.value.option;
                                option.title = {
                                    text: '2016' + tools.town() + '农村电子商务十强行业店铺数对比',
                                    x: 'center'
                                };
                                option.yAxis = [
                                    {
                                        type: 'value',
                                        axisLabel: {
                                            textStyle: {
                                                color: '#fff'
                                            }
                                        }
                                    }
                                ];
                                angular.forEach(option.xAxis[0].data, function (item, index) {
                                    option.xAxis[0].data[index] = {value: item, textStyle: {color: '#fff'}};
                                });
                                option.toolbox.show = false;
                                option.legend.show = false;
                                shopsMonitorChart.setOption(option);
                            }
                        }
                    });
                }
            } else {
                var datas = {
                    town: {
                        before: [33, 41, 55, 67, 71, 82, 90, 101, 114, 120],
                        after: [155, 189, 221, 244, 268, 298, 322, 405, 479, 555]
                    },
                    indestry: {
                        before: [19, 26, 45, 55, 79, 89, 105, 155, 169, 79],
                        after: [79, 102, 125, 156, 178, 196, 206, 223, 256, 288]
                    }
                };
                if (attrs.type == 'town') {
                    title = '2016' + tools.town() + '农村电子商务十强镇扶持前与扶持后店铺数对比';
                    var towns = tools.towns().slice(0, 9);
                    angular.forEach(towns, function (val) {
                        xAxis.push({
                            value: val,
                            textStyle: {color: '#fff'}
                        });
                    });
                } else if (attrs.type == 'indestry') {
                    title = '2016' + tools.town() + '农村电子商务十强行业扶持前与扶持后店铺数对比';
                    var industrys = tools.industrys().slice(0, 9);
                    angular.forEach(industrys, function (val) {
                        xAxis.push({
                            value: val,
                            textStyle: {color: '#fff'}
                        });
                    });
                }
                var option = {
                    title: {
                        text: title,
                        subtext: '',
                        x: 'center'
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data: []
                    },
                    toolbox: {
                        show: false
                    },
                    xAxis: [
                        {
                            type: 'category',
                            data: xAxis
                        }
                    ],
                    yAxis: [
                        {
                            type: 'value',
                            axisLabel: {
                                textStyle: {
                                    color: '#fff'
                                }
                            }
                        }
                    ],
                    series: [
                        {
                            name: '扶持前',
                            type: 'line',
                            data: datas[attrs.type].before,
                            markPoint: {
                                data: [
                                    {type: 'max', name: '最大值'},
                                    {type: 'min', name: '最小值'}
                                ]
                            },
                            markLine: {
                                data: [
                                    {type: 'average', name: '平均值'}
                                ]
                            }
                        },
                        {
                            name: '扶持后',
                            type: 'line',
                            data: datas[attrs.type].after,
                            markPoint: {
                                data: [
                                    {type: 'max', name: '最大值'},
                                    {type: 'min', name: '最小值'}
                                ]
                            },
                            markLine: {
                                data: [
                                    {type: 'average', name: '平均值'}
                                ]
                            }
                        }
                    ]
                };
                shopsMonitorChart.setOption(option);
            }


            shopsMonitorChart.on(echarts.config.EVENT.CLICK, function (param) {
                option.title.text = '2016' + param.name + '各村电子商务扶持前与扶持后店铺数对比';
                var villages = tools.villages().slice(0, 6);
                xAxis.length = 0;
                angular.forEach(villages, function (val) {
                    xAxis.push({
                        value: val,
                        textStyle: {color: '#fff'}
                    });
                });
                shopsMonitorChart.setOption(option);
            });

            scope.fullscreen = function () {
                $rootScope.$broadcast('fullscreen', option);
            }
        },
        template: '<div class="chart-container w h pr"><div class="chart-box w h"></div><div class = "full-screen right-bottom-pos" ng-click = "fullscreen()"></div></div>'
    }
}]);
// 效果监控-综合实力对比
MAIN.directive("radarMonitorChart", ["$rootScope", "tools", function ($rootScope, tools) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attrs) {
            var industryMonitorChart = echarts.init($(element).find('.chart-box')[0], theme);
            var titles = {
                town: '政府扶持前与扶持后五强镇综合实力对比',
                prod: '政府扶持前与扶持后五强产品综合实力对比',
                industry: '政府扶持前与扶持后五强产业综合实力对比'
            };
            var option;
            if (tools.datasource) {
                if (attrs.type == 'town') {
                    tools.get({
                        url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                        data: {
                            uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                            moduleId: 1316110055847,
                            moduleType: 'chart'
                        },
                        succ: function (resp) {
                            if (resp.success) {
                                option = resp.value.option;
                                option.series[0].data.length = 5;
                                option.legend.data.length = 5;
                                option.title = {
                                    text: titles[attrs.type],
                                    x: 'center'
                                };

                                industryMonitorChart.setOption(option);
                            }
                        }
                    });
                } else if (attrs.type == 'prod') {
                    var legend = ['五强产品扶持前', '五强产品扶持后'];
                    var series = [
                        {
                            name: '五强产品扶持前 vs 五强产品扶持后',
                            type: 'radar',
                            itemStyle: {
                                normal: {
                                    areaStyle: {
                                        type: 'default'
                                    }
                                }
                            },
                            data: [
                                {
                                    value: [45.6, 56.66, 33.67, 68.3, 59.6, 85.3, 62.3],
                                    name: '五强产品扶持前'
                                },
                                {
                                    value: [69.3, 72.3, 55.3, 76.5, 75.3, 98.69, 80.36],
                                    name: '五强产品扶持后'
                                }
                            ]
                        }
                    ];
                    option = {
                        title: {
                            text: titles[attrs.type],
                            subtext: ''
                        },
                        tooltip: {
                            trigger: 'axis'
                        },
                        legend: {
                            orient: 'vertical',
                            x: 'right',
                            y: 'top',
                            data: legend
                        },
                        toolbox: {
                            show: false,
                            feature: {
                                mark: {show: true},
                                dataView: {show: true, readOnly: false},
                                restore: {show: true},
                                saveAsImage: {show: true}
                            }
                        },
                        polar: [
                            {
                                indicator: [
                                    {text: '销售额', max: 100, axisLabel: {textStyle: {color: '#ddd'}}},
                                    {text: '销售量', max: 100, axisLabel: {textStyle: {color: '#ddd'}}},
                                    {text: '客单价', max: 100, axisLabel: {textStyle: {color: '#ddd'}}},
                                    {text: '流量', max: 100, axisLabel: {textStyle: {color: '#ddd'}}},
                                    {text: '咨询人数', max: 100, axisLabel: {textStyle: {color: '#ddd'}}},
                                    {text: '好评率', max: 100, axisLabel: {textStyle: {color: '#ddd'}}},
                                    {text: '回头率', max: 100, axisLabel: {textStyle: {color: '#ddd'}}},
                                ]
                            }
                        ],
                        calculable: true,
                        series: series
                    };
                    industryMonitorChart.setOption(option);
                } else {
                    tools.get({
                        url: '/Intelligence-Business-Management/getChartByModuleId.htm',
                        data: {
                            uuid: '69341649-c33d-4fd3-b6d1-7d264df7c8b0',
                            moduleId: 1316110055904,
                            moduleType: 'chart'
                        },
                        succ: function (resp) {
                            if (resp.success) {
                                option = resp.value.option;
                                option.series[0].data.length = 5;
                                option.legend.data.length = 5;
                                option.title = {
                                    text: titles[attrs.type],
                                    x: 'center'
                                };
                                industryMonitorChart.setOption(option);
                            }
                        }
                    });
                }
            } else {
                if (attrs.type == 'town') {
                    var legend = ['五强镇(乡)扶持前', '五强镇(乡)扶持后'];
                    var series = [
                        {
                            name: '五强镇(乡)扶持前 vs 五强镇(乡)扶持后',
                            type: 'radar',
                            itemStyle: {
                                normal: {
                                    areaStyle: {
                                        type: 'default'
                                    }
                                }
                            },
                            data: [
                                {
                                    value: [69, 56, 71, 66.3, 69.6, 75.3, 62.3],
                                    name: '五强镇(乡)扶持前'
                                },
                                {
                                    value: [89.3, 92.3, 88.3, 96.5, 85.3, 98.69, 80.36],
                                    name: '五强镇(乡)扶持后'
                                }
                            ]
                        }
                    ];
                } else if (attrs.type == 'prod') {
                    var legend = ['五强产品扶持前', '五强产品扶持后'];
                    var series = [
                        {
                            name: '五强产品扶持前 vs 五强产品扶持后',
                            type: 'radar',
                            itemStyle: {
                                normal: {
                                    areaStyle: {
                                        type: 'default'
                                    }
                                }
                            },
                            data: [
                                {
                                    value: [45.6, 56.66, 33.67, 68.3, 59.6, 85.3, 62.3],
                                    name: '五强产品扶持前'
                                },
                                {
                                    value: [69.3, 72.3, 55.3, 76.5, 75.3, 98.69, 80.36],
                                    name: '五强产品扶持后'
                                }
                            ]
                        }
                    ];
                } else {
                    var legend = ['五强产业扶持前', '五强行业扶持后'];
                    var series = [
                        {
                            name: '五强行业扶持前 vs 五强行业扶持后',
                            type: 'radar',
                            itemStyle: {
                                normal: {
                                    areaStyle: {
                                        type: 'default'
                                    }
                                }
                            },
                            data: [
                                {
                                    value: [55.6, 36.66, 33.67, 58.3, 49.6, 65.3, 42.3],
                                    name: '五强产业扶持前'
                                },
                                {
                                    value: [89.3, 82.3, 55.3, 96.5, 55.3, 98.69, 80.36],
                                    name: '五强产业扶持前'
                                }
                            ]
                        }
                    ];
                }
                option = {
                    title: {
                        text: titles[attrs.type],
                        subtext: ''
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        orient: 'vertical',
                        x: 'right',
                        y: 'top',
                        data: legend
                    },
                    toolbox: {
                        show: false,
                        feature: {
                            mark: {show: true},
                            dataView: {show: true, readOnly: false},
                            restore: {show: true},
                            saveAsImage: {show: true}
                        }
                    },
                    polar: [
                        {
                            indicator: [
                                {text: '销售额', max: 100, axisLabel: {textStyle: {color: '#ddd'}}},
                                {text: '销售量', max: 100, axisLabel: {textStyle: {color: '#ddd'}}},
                                {text: '客单价', max: 100, axisLabel: {textStyle: {color: '#ddd'}}},
                                {text: '流量', max: 100, axisLabel: {textStyle: {color: '#ddd'}}},
                                {text: '咨询人数', max: 100, axisLabel: {textStyle: {color: '#ddd'}}},
                                {text: '好评率', max: 100, axisLabel: {textStyle: {color: '#ddd'}}},
                                {text: '回头率', max: 100, axisLabel: {textStyle: {color: '#ddd'}}},
                            ]
                        }
                    ],
                    calculable: true,
                    series: series
                };
                industryMonitorChart.setOption(option);
            }


            scope.fullscreen = function () {
                $rootScope.$broadcast('fullscreen', option);
            }
        },
        template: '<div class="chart-container w h pr"><div class="chart-box w h"></div><div class = "full-screen right-bottom-pos" ng-click = "fullscreen()"></div></div>'
    }
}]);
// 系统概况-扶持指标完成率
MAIN.directive("supportFinishChart", ["$rootScope", "tools", function ($rootScope, tools) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attrs) {
            var chart_ele = document.getElementById("supportFinishChart");
            var supportFinishChart = echarts.init(chart_ele, theme);
            var option = {
                title: {
                    text: '2016年' + tools.town() + '县电子商务扶持指标完成率',
                    subtext: '',
                    x: 'center'
                },
                tooltip: {
                    formatter: "{a} <br/>{b} : {c}%"
                },
                toolbox: {
                    show: false,
                    feature: {
                        mark: {show: true},
                        restore: {show: true},
                        saveAsImage: {show: true}
                    }
                },
                series: [
                    {
                        name: '业务指标',
                        type: 'gauge',
                        splitNumber: 10,       // 分割段数，默认为5
                        axisLine: {            // 坐标轴线
                            lineStyle: {       // 属性lineStyle控制线条样式
                                color: [[0.2, '#228b22'], [0.8, '#48b'], [1, '#ff4500']],
                                width: 8
                            }
                        },
                        axisTick: {            // 坐标轴小标记
                            splitNumber: 10,   // 每份split细分多少段
                            length: 12,        // 属性length控制线长
                            lineStyle: {       // 属性lineStyle控制线条样式
                                color: 'auto'
                            }
                        },
                        axisLabel: {           // 坐标轴文本标签，详见axis.axisLabel
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                color: 'auto'
                            }
                        },
                        splitLine: {           // 分隔线
                            show: true,        // 默认显示，属性show控制显示与否
                            length: 30,         // 属性length控制线长
                            lineStyle: {       // 属性lineStyle（详见lineStyle）控制线条样式
                                color: 'auto'
                            }
                        },
                        pointer: {
                            width: 5
                        },
                        title: {
                            show: true,
                            offsetCenter: [0, '-40%'],       // x, y，单位px
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                fontWeight: 'bolder'
                            }
                        },
                        detail: {
                            formatter: '{value}%',
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                color: 'auto',
                                fontWeight: 'bolder'
                            }
                        },
                        data: [{value: 98.4, name: ''}]
                    }
                ]
            };

            supportFinishChart.setOption(option);
            scope.fullscreen = function () {
                $rootScope.$broadcast('fullscreen', option);
            }
        },
        template: '<div class="w h chart-container"><div id = "supportFinishChart" class="w h"></div><div class = "full-screen right-bottom-pos" ng-click = "fullscreen()"></div></div>'
    }
}]);
// 系统概况-销售指标完成率
MAIN.directive("salesFinishChart", ["$rootScope", "tools", function ($rootScope, tools) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attrs) {
            var chart_ele = document.getElementById("salesFinishChart");
            var salesFinishChart = echarts.init(chart_ele, theme);
            var option = {
                title: {
                    text: '2016年' + tools.town() + '县电子商务销售指标完成率',
                    subtext: '',
                    x: 'center'
                },
                tooltip: {
                    formatter: "{a} <br/>{b} : {c}%"
                },
                toolbox: {
                    show: false,
                    feature: {
                        mark: {show: true},
                        restore: {show: true},
                        saveAsImage: {show: true}
                    }
                },
                series: [
                    {
                        name: '业务指标',
                        type: 'gauge',
                        splitNumber: 10,       // 分割段数，默认为5
                        axisLine: {            // 坐标轴线
                            lineStyle: {       // 属性lineStyle控制线条样式
                                color: [[0.2, '#228b22'], [0.8, '#48b'], [1, '#ff4500']],
                                width: 8
                            }
                        },
                        axisTick: {            // 坐标轴小标记
                            splitNumber: 10,   // 每份split细分多少段
                            length: 12,        // 属性length控制线长
                            lineStyle: {       // 属性lineStyle控制线条样式
                                color: 'auto'
                            }
                        },
                        axisLabel: {           // 坐标轴文本标签，详见axis.axisLabel
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                color: 'auto'
                            }
                        },
                        splitLine: {           // 分隔线
                            show: true,        // 默认显示，属性show控制显示与否
                            length: 30,         // 属性length控制线长
                            lineStyle: {       // 属性lineStyle（详见lineStyle）控制线条样式
                                color: 'auto'
                            }
                        },
                        pointer: {
                            width: 5
                        },
                        title: {
                            show: true,
                            offsetCenter: [0, '-40%'],       // x, y，单位px
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                fontWeight: 'bolder'
                            }
                        },
                        detail: {
                            formatter: '{value}%',
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                color: 'auto',
                                fontWeight: 'bolder'
                            }
                        },
                        data: [{value: 89.8, name: ''}]
                    }
                ]
            }
            salesFinishChart.setOption(option);
            /*setInterval(function () {
             option.series[0].data[0].value = Number((option.series[0].data[0].value + 0.1).toFixed(1));
             salesFinishChart.setOption(option);
             }, 3000);*/
            scope.fullscreen = function () {
                $rootScope.$broadcast('fullscreen', option);
            }
        },
        template: '<div class="w h chart-container"><div id = "salesFinishChart" class="w h"></div><div class = "full-screen right-bottom-pos" ng-click = "fullscreen()"></div></div>'
    }
}]);